<template>
  <div>
    <div style="text-align:left">
      患者信息：
      <el-tag >姓名：{{patient.realName}}</el-tag>
      <el-tag >病历号：{{patient.caseNumber}}</el-tag>
      <el-tag >年龄：{{patient.age}}</el-tag>
      <el-tag >性别：{{patient.gender}}</el-tag>
    </div>
    <el-divider></el-divider>
    <div style="font-size:20px;text-align:left">
      <i class="el-icon-document-checked">门诊确诊</i>
    </div>
    <el-divider></el-divider>
    <el-descriptions title="确诊信息录入：" :column="1" border style="width:80%">
      <el-descriptions-item label="诊断结果：" :labelStyle="{'width':'120px'}">
        <el-input type="textarea" :auto-size="{minRows:2,maxRows:4}" v-model="patientDiagnosis.diagnosis" placeholder="输入诊断结果判断"></el-input>
      </el-descriptions-item>
      <el-descriptions-item label="处理意见：" :labelStyle="{'width':'120px'}">
        <el-input type="textarea" :auto-size="{minRows:2,maxRows:4}" v-model="patientDiagnosis.cure" placeholder="输入治疗意见"></el-input>
      </el-descriptions-item>
    </el-descriptions>
    <el-divider></el-divider>
    <div style="text-align:left">
      <el-button type="primary" @click="updatePatientDiagnosis">确诊提交</el-button>
      <el-button type="primary" @click="clearPatientDiagnosis">重置输入</el-button>
    </div>
  </div>
</template>
<script>
import qs from 'qs'
import {isNullMessage} from '../../../util/util'
import {getSessionStorage, setSessionStorage} from "@/util/common";
import {ElMessage} from "element-plus";
export default {
  data(){
    return{
      patientDiagnosis:{
        registerId:'',
        diagnosis:'',
        cure:''
      },//提交确诊信息
      patient:{} //患者信息
    }    
  },
  methods:{

    updatePatientDiagnosis:function (){
      this.patientDiagnosis.registerId=this.patient.id
      let url='http://localhost:8092/medicalrecord/update'
      this.$axios.post(url,this.patientDiagnosis).then(resp=>{
        ElMessage({
          type:'info',
          message:'患者确诊成功'
        })
      })
    },

  },
  mounted() {
    if(getSessionStorage("patient")==null)
    {
      ElMessage({
        type:"warning",
        message:'请选择患者！'
      })
      return
    }
    this.patient=getSessionStorage("patient")
  }
}
</script>